import {getData, setData, startLoading} from '../utils/util.js'
import {Get} from '../utils/http.js'

const getToken = () => getData('token')

const login = (name, pass) => {
  startLoading('登录中')
  Get('/wxApp/login', d, (data) => {
    setData('token', data)
  })
}

// 获取用户资料
const getUser = (callback) => {
  let user = getData('userInfo')
  typeof callback == 'function' && callback(user)
}

export {
  login,
  getUser,
  getToken
}
